blob: 9fd244a3139caf0e16396403420fff6661c2a25b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import { get, auth, post } from '$lib/utils';
import { redirect } from '@sveltejs/kit';
export async function load({ cookies, params, parent }) {
let { user } = await parent();
let { id } = params;
let { amount } = await get(`/fund/${id}`);
if (!amount) throw redirect(307, `/fund/${id}`);
if (!user) throw redirect(307, `/register?redirect=/fund/${id}/sweep`);
await post('/take', { amount, id }, auth(cookies));
return { amount, id };
}
|